//
//  PlaySoundOrMusic.m
//  Beat Bin Laden
//
//  Created by How Charles on 11-9-24.
//  Copyright 2011 hust. All rights reserved.
//

#import "GameMusicSetting.h"



@implementation GameMusicSetting


static bool IsSoundOn=true;
static bool IsMusicOn=true;
static bool IsVibrateOn=true;  //震动效果
static int iGameLevel=GAME_LEVEL_NORMAL;

///////音效设置
+(bool)getIsSoundOn
{
	return IsSoundOn;
}

+(bool)setIsSoundOn:(bool)state
{
	IsSoundOn=state;
}

///////背景音乐设置
+(bool)getIsMusicOn
{
	return IsMusicOn;
}

+(bool)setIsMusicOn:(bool)state
{
	IsMusicOn=state;
}

/////震动设置
+(bool)getIsVibrateOn
{
	return IsVibrateOn;
}

+(bool)setIsVibrateOn:(bool)state
{
	IsVibrateOn=state;
}

///////////////播放动作
+(void)playBackgroundMusic:(NSString *)str
{
	//[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BGSound0.mp3"];
	if (IsMusicOn) {
		[[SimpleAudioEngine sharedEngine] playBackgroundMusic:str];
	}
	else {
		[[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
	}

}

+(void)pauseBackgroundMusic
{

	[[SimpleAudioEngine sharedEngine] pauseBackgroundMusic];
	
}


+(void)resumeBackgroundMusic
{
	//[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BGSound0.mp3"];
	if (IsMusicOn) {
		[[SimpleAudioEngine sharedEngine] resumeBackgroundMusic];
	}
	
}

+(void)stopBackgroundMusic
{
	
	[[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
	
}

+(void)playEffect:(NSString *)str
{
	//[[SimpleAudioEngine sharedEngine] playEffect:@"fail.mp3"];
	
	if (IsSoundOn) {
		[[SimpleAudioEngine sharedEngine] playEffect:str];
	}
}

+(void)playButtonClickEffect
{
	//[[SimpleAudioEngine sharedEngine] playEffect:@"fail.mp3"];
	
	if (IsSoundOn) {
		[[SimpleAudioEngine sharedEngine] playEffect:@"button.caf"];
	}
}


+(void)Vibrate
{
	
	if (IsVibrateOn) {
		/////let the iphone Vibrate,震动效果
		AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
	}
}


#pragma mark game level seeting

+(int)getGameLevelSeeting
{
	return iGameLevel;
}


+(void)setGameLevel:(int)level
{
	iGameLevel=level;
}


@end
